package com.design_pattern.templatemethod;

/**
 * 模板方法设计模式
 */
public class Main {
    public static void main(String[] args) {
        AbstractSchool d3School = new Main().new D3School();
        AbstractSchool lwSchool = new Main().new LWSchool();
        d3School.showSchool();
        lwSchool.showSchool();


    }

    class D3School extends AbstractSchool {
        @Override
        protected void getSchoolName() {
            System.out.println("道三学校。。");
        }

        @Override
        protected void getSchoolNo() {
            System.out.println("1888。。");
        }
    }

    class LWSchool extends AbstractSchool {
        @Override
        protected void getSchoolName() {
            System.out.println("龙湾学校。。");
        }

        @Override
        protected void getSchoolNo() {
            System.out.println("9999。。");
        }
    }

    abstract class AbstractSchool {
        protected void showSchool() {
            getSchoolName();
            getSchoolNo();

        }

        abstract protected void getSchoolName();

        abstract protected void getSchoolNo();
    }
}
